package com.zjitc.mapper;

import com.zjitc.pojo.Address;
import com.zjitc.pojo.Car;
import org.apache.ibatis.annotations.Param;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Create By IntelliJ IDEA
 *
 * @author: myq
 * @create-Time: 2017/11/20  17:09
 */
@Component
public interface CarMapper {

    /**
     * 检查购物车
     *
     * @param uid
     * @param pid
     * @return
     */
    Car checkcar(@Param("uid") String uid, @Param("pid") String pid);

    /**
     * 检查购物车
     *
     * @param uid
     * @return
     */
    List<Car> takeoutCar(@Param("uid") String uid);

    /**
     * 更新购物车
     *
     * @param scid
     * @param count
     * @param subtotal
     * @return
     */
    int updatecar(@Param("scid") String scid, @Param("count") int count, @Param("subtotal") Float subtotal);

    /**
     * 添加新商品
     *
     * @param uid
     * @param count
     * @param pid
     * @return
     */
    void addnew(@Param("scid") String scid, @Param("count") int count, @Param("subtotal") Float subtotal, @Param("uid") String uid, @Param("pid") String pid);

    /**
     * 清空购物车
     *
     * @param uid
     * @return
     */
    int deleteAll(@Param("uid") String uid);

    /**
     * 通过pid 删除购物车内商品
     *
     * @param pid
     * @param uid
     * @return
     */
    int deletebypid(@Param("pid") String pid, @Param("uid") String uid);

    /**
     * 通过pid 删除购物车内商品
     *
     * @param pid
     */
    void deletebyPid(String pid);


    int addaddress(Address address);

    List<Address> findAlladdress(String uid);

    Address findaddress(String aid);

    int updateaddress(Address address);
}
